Reactive with ClojureScript Recipes by Nicolas Modrzyk

Reactive with ClojureScript Recipes by Nicolas Modrzyk

Author:Nicolas Modrzyk
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


The second line is the Clojure declare usage:

(declare client send-message)

The on-connect function makes use of the send-message function before it is actually defined, so we do an ahead declaration so the Compiler does not complain about a missing symbol.

The rest of the code is now rather easy-going, so here comes the frontend.app namespace in full:

(ns frontend.app

(:require

[cljsjs.paho]

[frontend.utils :as utils]))

(declare client send-message)

(def topic "/cljsjs/paho")

(defn on-connect []

(println "Connected")

(.subscribe client topic #js {:qos 0})

(println "Subscribed")

(send-message "Hello MQTT!" topic 0)

(println "Sent message."))



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.